/*****************************************************************
 MYD Engine v0.1

 File: myd_mesh3d.h
 Created: 15/08/09
*****************************************************************/

#ifndef MYD_ENTITY3D_H
#define MYD_ENTITY3D_H

#include "system/myd_system.h"
#include "entities/myd_entity.h"
#include "graphics/graphicsstructs.h"
#include "graphics/myd_vertexbuffer.h"
#include "graphics/myd_indexbuffer.h"
#include "graphics/myd_material.h"
#include "graphics/myd_texture.h"

namespace myd
{
	class Renderer;

	class MYD_API Entity3d : public Entity
	{
	//methods
	public:
		Entity3d(Renderer* renderer);
		~Entity3d(void);

	private:
		Vertexbuffer<TextureVertex,TEXTURE_VERTEX>::Ptr VBO;
		Indexbuffer::Ptr IBO;

		std::vector<D3DMATERIAL9> materialsVector;
		std::vector<IDirect3DTexture9*> texturesVector;

		DWORD materialsAmm;
		LPD3DXMESH wn_mesh;

	public:
		void loadXFile(char* path, char* filename);
		void draw();

		Vertexbuffer<TextureVertex,TEXTURE_VERTEX>::Ptr getVB();
		const Vertexbuffer<TextureVertex,TEXTURE_VERTEX>::Ptr getVB() const;
		//void setVB(Vertexbuffer<TextureVertex,TEXTURE_VERTEX>::Ptr VBO);
		void setVB(Vertexbuffer<TextureVertex,TEXTURE_VERTEX>::Ptr VBO);

		void setTexture();

		//properties
		Vertexbuffer<TextureVertex,TEXTURE_VERTEX>::Ptr wn_VBO;

		Material wn_material;
		//Texture wn_texture;

	};
}//end namespace
#endif //MYD_ENTITY3D_H